package com.neuedu.corejava.ch6;

import java.util.Scanner;

public class WetherSystem {
      
	//使用递归算法计算阶乘：n!
	
	public static int factorial(int i,int num){
		num *=i--;
		if (i==0) {
			return num;
		}else {
			return factorial(i,num);
		}
	}
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		System.out.println("请输入一个整数：");
		int i = scanner.nextInt();
		System.out.println(i+"的阶乘是"+factorial(i,1));	
	}
}
